package cn.zhaozhiqi.config;

import cn.zhaozhiqi.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: Neuronet
 * @Date: 2023-09-25
 * @Description: 登录拦截器配置类
 * @Version:1.0
 */
// 代表当前类是一个配置类
//@Configuration
public class LoginInterceptorConfig implements WebMvcConfigurer {
    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**") // 拦截哪些路径
                .excludePathPatterns("/login/account"); // 放行哪些路// 使用哪个拦截器
    }
}
